<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">


    <title> - 空白页</title>
    <meta name="keywords" content="">
    <meta name="description" content="">


    <link rel="shortcut icon" href="favicon.ico"> <link href="css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css?v=4.1.0" rel="stylesheet">

    <link href="css/plugins/iCheck/custom.css" rel="stylesheet">
</head>

<body class="gray-bg">

    
    <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>用户</h5>
                        <div class="ibox-tools">
                            <a href="?r=user/insert&k=<?=$key;?>" class="btn btn-info dropdown-toggle" title="创建新用户">创建新用户</a>
                            <a href="?r=user/index&k=<?=$key;?>" class="btn btn-warning dropdown-toggle" title="用户列表">刷新列表</a>
                            
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="dropdown-toggle" data-toggle="dropdown" href="table_basic.html#">
                                <i class="fa fa-wrench"></i>
                            </a>
                            <ul class="dropdown-menu dropdown-user">
                                <li><a href="table_basic.html#">选项1</a>
                                </li>
                                <li><a href="table_basic.html#">选项2</a>
                                </li>
                            </ul>
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">

                        <table class="table">
                            <thead>
                                <tr>
                                    <th></th>
                                    <th>host</th>
                                    <th>用户名</th>
                                    <th>操作</th>
                                </tr>
                            </thead>
                            <tbody>
                            <?php foreach($user as $k=>$v){?>
                                <tr class="user-name">
                                    <td>
                                        <input type="checkbox" class="i-checks" name="input[]"> 
                                    </td>
                                    <td><?=$v['Host']?></td>
                                    <td><?=$v['User']?></td>
                                    <td>
                                        <a href="javascript:" class="delete" title="删除">
                                            <i class="glyphicon glyphicon-trash user-delete" data-host="<?=$v['Host']?>" data-user="<?=$v['User']?>" data-k="<?=$key;?>" ></i>
                                        </a> | 
                                        <a href="?r=user/update&host=<?=$v['Host']?>&user=<?=$v['User']?>&k=<?=$key;?>" title="修改">
                                            <i class="glyphicon  fa fa-wrench"></i>
                                        </a> | 
                                        <a href="?r=user/select&host=<?=$v['Host']?>&user=<?=$v['User']?>&k=<?=$key;?>" class="collapse-link" title="详情">
                                            <i class="glyphicon glyphicon-list"></i>
                                        </a>
                                    </td>
                                </tr>
                                <?php }?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
    

    <!-- 全局js -->
    <script src="js/jquery.min.js?v=2.1.4"></script>
    <script src="js/bootstrap.min.js?v=3.3.6"></script>

    <!-- 自定义js -->
    <script src="js/content.js?v=1.0.0"></script>
    
    <script src="js/plugins/iCheck/icheck.min.js"></script>

    <script src="js/demo/peity-demo.js"></script>
    <script src="js/jq.js"></script>

    <!-- Peity -->
    <script src="js/plugins/peity/jquery.peity.min.js"></script>


    <script>

        $(".user-delete").click(function(){
            if(confirm('是否删除')){
                var host = $(this).data('host');
                var user = $(this).data('user');
                var k = $(this).data('k');
                var _this = $(this);
                $.ajax({
                    type:'post',
                    url:'?r=user/deletes',
                    data:{'host':host,'user':user, 'k':k},
                    success:function(mas){
                        if(mas==1){
                            _this.parent().parent().parent().remove();
                            alert('删除成功');

                        }
                    }
                })
            }
        })

    </script>



</body>

</html>